import { FIELD_TYPE, FILTER_TYPE } from '@/framework/components/common/Portal/type'

export const getRelation = (type: FIELD_TYPE | string): Array<any> => {
  switch (type) {
    case FIELD_TYPE.INPUT:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.LIKE, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.SWITCH:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.NOT_EQUAL, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.NUMBER:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.BETWEEN, FILTER_TYPE.NOT_EQUAL, FILTER_TYPE.GREATER,
        FILTER_TYPE.GREATER_EQUAL, FILTER_TYPE.LESS, FILTER_TYPE.LESS_EQUAL, FILTER_TYPE.IN, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.SELECT:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.IN, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.TREE:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.IN, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.DATE:
      return [FILTER_TYPE.BETWEEN, FILTER_TYPE.GREATER, FILTER_TYPE.LESS, FILTER_TYPE.NOT_BETWEEN, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.DATETIME:
      return [FILTER_TYPE.BETWEEN,  FILTER_TYPE.GREATER, FILTER_TYPE.LESS, FILTER_TYPE.NOT_BETWEEN, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.HREF:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.LIKE, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.HTML:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.LIKE, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.TEXT_AREA:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.LIKE, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.ENTITY:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.LIKE, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.SELECT_MULTI_IN_ONE:
      return [FILTER_TYPE.CONTAIN, FILTER_TYPE.CONTAIN_IN_OR, FILTER_TYPE.CONTAIN_IN_AND, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    case FIELD_TYPE.TREE_MULTI_IN_ONE:
      return [FILTER_TYPE.CONTAIN, FILTER_TYPE.CONTAIN_IN_OR, FILTER_TYPE.CONTAIN_IN_AND, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
    default:
      return [FILTER_TYPE.EQUAL, FILTER_TYPE.NULL, FILTER_TYPE.NOT_NULL]
  }
}
